/*    */ package com.feeyin.radar.sys.service.impl;
/*    */ 
/*    */ import com.feeyin.radar.commons.StringUtils;
/*    */ import com.feeyin.radar.sys.dao.ManageSetDAO;
/*    */ import com.feeyin.radar.sys.dao.SaleStageSetDAO;
/*    */ import com.feeyin.radar.sys.form.SaleStageForm;
/*    */ import com.feeyin.radar.sys.model.ManageSet;
/*    */ import com.feeyin.radar.sys.model.SaleStageSet;
/*    */ import com.feeyin.radar.sys.service.SaleStageSetService;
/*    */ import java.util.List;
/*    */ 
/*    */ public class SaleStageSetServiceImpl
/*    */   implements SaleStageSetService
/*    */ {
/*    */   private SaleStageSetDAO saleStageSetDAO;
/*    */   private ManageSetDAO manageSetDAO;
/*    */ 
/*    */   public SaleStageSetDAO getSaleStageSetDAO()
/*    */   {
/* 25 */     return this.saleStageSetDAO;
/*    */   }
/*    */ 
/*    */   public void setSaleStageSetDAO(SaleStageSetDAO saleStageSetDAO) {
/* 29 */     this.saleStageSetDAO = saleStageSetDAO;
/*    */   }
/*    */ 
/*    */   public ManageSetDAO getManageSetDAO() {
/* 33 */     return this.manageSetDAO;
/*    */   }
/*    */ 
/*    */   public void setManageSetDAO(ManageSetDAO manageSetDAO) {
/* 37 */     this.manageSetDAO = manageSetDAO;
/*    */   }
/*    */ 
/*    */   public List getSaleStages() {
/* 41 */     return this.saleStageSetDAO.getSaleStages();
/*    */   }
/*    */ 
/*    */   public ManageSet getAvgSingle() {
/* 45 */     ManageSet manageSet = new ManageSet();
/* 46 */     manageSet.setMType("4");
/* 47 */     manageSet.setStatus("0");
/* 48 */     return this.manageSetDAO.getManageSetByTypeStatus(manageSet);
/*    */   }
/*    */ 
/*    */   public boolean insertSaleStage(SaleStageForm saleStageForm) {
/* 52 */     if (saleStageForm == null) return false;
/*    */ 
/* 54 */     this.saleStageSetDAO.deleteSaleStage();
/*    */ 
/* 56 */     ManageSet manageSet = new ManageSet();
/* 57 */     manageSet.setCode("avgSingle");
/* 58 */     manageSet.setStatus("0");
/* 59 */     manageSet.setMValue(saleStageForm.getAvgSingle());
/* 60 */     this.manageSetDAO.updateManageSetByCode(manageSet);
/*    */ 
/* 62 */     int num = 0;
/* 63 */     for (int i = 0; i < saleStageForm.getStageName().length; i++) {
/* 64 */       if ((StringUtils.isEmpty(saleStageForm.getStageName()[i])) || 
/* 65 */         (StringUtils.isEmpty(saleStageForm.getStageDesc()[i])) || 
/* 66 */         (saleStageForm.getSuccessRate()[i] == null)) continue;
/* 67 */       SaleStageSet saleStageSet = new SaleStageSet();
/* 68 */       saleStageSet.setStageCode(num + 1+"");
/* 69 */       saleStageSet.setStageName(saleStageForm.getStageName()[i]);
/* 70 */       saleStageSet.setStageDesc(saleStageForm.getStageDesc()[i]);
/* 71 */       saleStageSet.setSuccessRate(saleStageForm.getSuccessRate()[i]);
/* 72 */       if (saleStageForm.getUsefulTime()[i] != null) {
/* 73 */         saleStageSet.setUsefulTime(saleStageForm.getUsefulTime()[i]);
/*    */       }
/* 75 */       this.saleStageSetDAO.insertSaleStage(saleStageSet);
/* 76 */       num++;
/*    */     }
/*    */ 
/* 80 */     return true;
/*    */   }
/*    */ 
/*    */   public boolean deleteSaleStage()
/*    */   {
/* 96 */     return this.saleStageSetDAO.deleteSaleStage();
/*    */   }
/*    */ }

/* Location:           C:\Users\e547415\MyProject\rone\WEB-INF\classes\
 * Qualified Name:     com.feeyin.radar.sys.service.impl.SaleStageSetServiceImpl
 * JD-Core Version:    0.6.0
 */